home *** CD-ROM | disk | FTP | other *** search
- class IntroPage extends mx.core.UIObject
- {
- var __title;
- var __priDesc;
- var __highlight1;
- var __highlight2;
- var __numHighlights;
- var __preloadsFinished;
- var __preloadsInterval;
- var __highlightListener;
- var __secDesc;
- var __secList;
- var dispatchEvent;
- static var symbolName = "IntroPage";
- static var symbolOwner = IntroPage;
- var className = "IntroPage";
- static var version = "0.0.0.1";
- static var __maxPageHeight = 405;
- static var __pageBorder = 5;
- static var __vSpacing = 5;
- static var __hSpacing = 5;
- var __nextDepth = 1;
- function IntroPage()
- {
- super();
- mx.events.EventDispatcher.initialize(this);
- }
- function set enabled(activeStatus)
- {
- if(activeStatus == true)
- {
- var _loc3_ = "<headline>" + this.__title.htmlText.slice(18,this.__title.htmlText.length - 19) + "</headline>";
- var _loc2_ = new TextFormat();
- _loc2_.color = 0;
- this.__title.setTextFormat(_loc2_);
- this.__title.setNewTextFormat(_loc2_);
- this.__title.htmlText = _loc3_;
- trace("new title: " + _loc3_);
- }
- else
- {
- _loc3_ = "<headlinedisabled>" + this.__title.htmlText.slice(10,this.__title.htmlText.length - 11) + "</headlinedisabled>";
- _loc2_ = new TextFormat();
- _loc2_.color = 8421504;
- this.__title.setTextFormat(_loc2_);
- this.__title.setNewTextFormat(_loc2_);
- this.__title.htmlText = _loc3_;
- trace("new title: " + _loc3_);
- }
- this.__priDesc.enabled = activeStatus;
- this.__highlight1.enabled = this.__highlight2.enabled = activeStatus;
- }
- function init(Void)
- {
- super.init();
- }
- function size(Void)
- {
- super.size();
- }
- function doneSetting()
- {
- if(this.__numHighlights == 0 || this.__numHighlights == undefined)
- {
- this.sendMessage("pageReady");
- }
- else if(this.__numHighlights == this.__preloadsFinished)
- {
- if(this.__preloadsInterval != undefined)
- {
- clearInterval(this.__preloadsInterval);
- }
- this.sendMessage("pageReady");
- }
- else
- {
- this.__preloadsInterval = setInterval("doneSetting",500);
- }
- }
- function set title(newTitle)
- {
- function workingLayout(bodyText, width, targetObject)
- {
- trace("targetObject: " + targetObject);
- var titleFormat = _level0.styleSheetToTextFormat(_global.textStyles.getStyle("headline"));
- targetObject.html = true;
- with(targetObject)
- {
- embedFonts = true;
- setTextFormat(titleFormat);
- setNewTextFormat(titleFormat);
- styleSheet = _global.textStyles;
- border = false;
- selectable = false;
- autoSize = true;
- borderColor = 13421772;
- multiline = true;
- wordWrap = true;
- }
- var oneRowMetrics = titleFormat.getTextExtent("a",width);
- var twoRowMetrics = titleFormat.getTextExtent("a\na",width);
- var tfhIncrement = twoRowMetrics.textFieldHeight - oneRowMetrics.textFieldHeight;
- var metrics = titleFormat.getTextExtent(bodyText,width);
- var finalHtmlText = "<headline><textformat leading=\'" + myLeading + "\'>" + bodyText + "</textformat></headline>";
- targetObject.htmlText = finalHtmlText;
- var positiveLeading = myLeading >= 0 ? myLeading : - myLeading;
- var calculatedHeight = targetObject._height;
- targetObject.autoSize = false;
- targetObject._height = metrics.textFieldHeight + 1;
- targetObject.htmlText = "<headline><textformat leading=\'0\'>" + bodyText + "</textformat></headline>";
- var unleadedTextHeight1 = targetObject.textHeight;
- var unleadedFieldHeight = targetObject._height;
- targetObject.htmlText = "<headline><textformat leading=\'-1\'>" + bodyText + "</textformat></headline>";
- var unleadedTextHeight2 = targetObject.textHeight;
- var numRows = unleadedTextHeight2 - unleadedTextHeight1;
- numRows = numRows >= 0 ? numRows : - numRows;
- trace("numRows of text: " + numRows);
- targetObject.htmlText = finalHtmlText;
- targetObject._height = unleadedFieldHeight + (numRows - 1) * myLeading;
- }
- this.createTextField("__title",this.__nextDepth,IntroPage.__pageBorder,IntroPage.__pageBorder,365,50);
- this.__nextDepth = this.__nextDepth + 1;
- var myLeading = -5;
- var titleFormat = _level0.styleSheetToTextFormat(_global.textStyles.getStyle("headline"));
- workingLayout(newTitle,365,this.__title);
- }
- function set primaryDescription(newDesc)
- {
- trace("PRIMARYDESCRIPTION");
- trace("IntroPage instance received primaryDescription: " + newDesc);
- if(this.__priDesc == undefined)
- {
- this.__priDesc = this.createClassObject(mx.controls.TextArea,"primaryDesc",this.__nextDepth);
- this.__priDesc.editable = false;
- this.__priDesc.label.selectable = false;
- this.__priDesc.wordWrap = true;
- this.__priDesc.html = true;
- this.__priDesc.borderStyle = "none";
- this.__priDesc.embedFonts = true;
- this.__priDesc.styleSheet = _global.textStyles;
- this.__priDesc.setStyle("themeColor","0x005BAB");
- this.__priDesc.setStyle("styleName","scrollTextAreaStyle");
- this.__nextDepth = this.__nextDepth + 1;
- }
- if(this.__priDesc.text != newDesc)
- {
- this.__priDesc.text = "<boxdesc>" + newDesc + "</boxdesc>";
- this.__priDesc._x = IntroPage.__pageBorder;
- this.__priDesc._y = this.__title._y + this.__title.height + 2 * IntroPage.__vSpacing - 16;
- var _loc6_ = undefined;
- _loc6_ = this.__priDesc.styleSheet._styles.pagebody.getTextExtent(this.removeHTMLTags(newDesc),365);
- if(_loc6_.textFieldHeight > 100)
- {
- var _loc7_ = _loc6_.ascent + _loc6_.descent;
- var _loc3_ = _loc7_ + 2;
- var _loc4_ = 96 - _loc7_;
- var _loc5_ = 0;
- while(_loc4_ > _loc3_)
- {
- _loc5_ = _loc5_ + 1;
- _loc4_ -= _loc3_;
- }
- var _loc9_ = 4 + _loc7_ + _loc5_ * _loc3_;
- this.__priDesc.setSize(365,_loc7_ + _loc5_ * _loc3_ + 4);
- }
- else
- {
- _loc7_ = _loc6_.ascent + _loc6_.descent;
- _loc3_ = _loc7_ + 4;
- _loc4_ = _loc6_.textFieldHeight;
- _loc5_ = 0;
- while(_loc4_ > _loc3_)
- {
- _loc5_ = _loc5_ + 1;
- _loc4_ -= _loc3_;
- }
- _loc9_ = _loc5_ != 0 ? 6 + _loc7_ + _loc5_ * _loc3_ : 6 + _loc7_;
- this.__priDesc.setSize(365,_loc9_);
- }
- }
- }
- function set highlight1(newHighlight)
- {
- _level0.showObjectSummary();
- this.__highlight1 = this.attachMovie("HighlightBoxout","Highlight1",this.__nextDepth,newHighlight);
- this.__highlight1.setSize(361,131);
- this.__highlight1._x = IntroPage.__pageBorder + 2;
- this.__highlight1._y = 138;
- this.__highlight1.image = newHighlight.imagePath;
- this.__nextDepth = this.__nextDepth + 1;
- this.__highlightListener = new Object();
- this.__highlightListener.press = function(evtObj)
- {
- _level0.entries.selectedIndex = evtObj.target.__target;
- _level0.pageMgr.buildPage(2,_level0.dataSource[_level0.sections.selectedIndex].data[evtObj.target.__target]);
- };
- this.__highlight1.addEventListener("press",this.__highlightListener);
- this.__highlight1.enabled = true;
- }
- function set highlight2(newHighlight)
- {
- this.__highlight2 = this.attachMovie("HighlightBoxout","Highlight2",this.__nextDepth,newHighlight);
- this.__highlight2.setSize(361,131);
- this.__highlight2._x = IntroPage.__pageBorder + 2;
- this.__highlight2._y = this.__highlight1._y + 130 + IntroPage.__vSpacing;
- this.__highlight2.image = newHighlight.imagePath;
- this.__nextDepth = this.__nextDepth + 1;
- this.__highlight2.addEventListener("press",this.__highlightListener);
- this.__highlight2.enabled = true;
- }
- function set secondaryDescription(newDesc)
- {
- if(this.__secDesc == undefined)
- {
- this.__secDesc = this.createClassObject(mx.controls.TextArea,"secondaryDesc",this.__nextDepth);
- this.__nextDepth = this.__nextDepth + 1;
- this.__secDesc.label.selectable = false;
- this.__secDesc.borderStyle = "none";
- this.__secDesc.html = true;
- this.__secDesc.embedFonts = true;
- this.__secDesc.styleSheet = _global.textStyles;
- }
- if(this.__secDesc.text != newDesc)
- {
- this.__secDesc.text = newDesc;
- this.__secDesc.setSize(365,20);
- }
- this.__secDesc._x = IntroPage.__pageBorder;
- this.__secDesc._y = this.__highlight1._y + this.__highlight1.height + IntroPage.__vSpacing + 3;
- }
- function set secondaryList(newContents)
- {
- if(this.__secList == undefined)
- {
- this.__secList = this.createClassObject(mx.controls.List,"secondaryList",this.__nextDepth);
- this.__nextDepth = this.__nextDepth + 1;
- this.__secList.html = false;
- this.__secList.embedFonts = true;
- this.__secList.setStyle("styleName","footerListStyle");
- }
- this.__secList.dataProvider = newContents;
- this.__secList._x = IntroPage.__pageBorder + 2;
- this.__secList._y = this.__secDesc._y + this.__secDesc.height + IntroPage.__vSpacing;
- this.__secList.vScrollPolicy = "auto";
- var _loc6_ = 2;
- var _loc8_ = newContents.length;
- if(_loc8_ > 1)
- {
- var _loc10_ = this.__secDesc._y + this.__secDesc.height;
- var _loc2_ = IntroPage.__maxPageHeight - _loc10_ - 2 * IntroPage.__vSpacing;
- var _loc5_ = 0;
- _loc5_ = _loc2_ % this.__secList.rowHeight < 4 ? Math.floor(_loc2_ / this.__secList.rowHeight) - 1 : Math.floor(_loc2_ / this.__secList.rowHeight);
- _loc6_ += _loc5_ * this.__secList.rowHeight;
- this.__secList.setSize(364,_loc6_);
- }
- else
- {
- this.__secList.setSize(364,this.__secList.rowHeight + 2);
- }
- var _loc4_ = new Object();
- _loc4_.change = function(evtObj)
- {
- var _loc2_ = _level0.sections.selectedIndex;
- var _loc3_ = evtObj.target.selectedIndex;
- var _loc1_ = _level0.dataSource[_loc2_].updates[_loc3_].target;
- _level0.entries.selectedIndex = _loc1_;
- _level0.pageMgr.buildPage(2,_level0.dataSource[_loc2_].data[_loc1_]);
- };
- this.__secList.addEventListener("change",_loc4_);
- }
- function setLayout(Void)
- {
- var _loc2_ = undefined;
- this.__title._y = this.__title._x = _loc2_ = 0;
- _loc2_ += this.__title.height + IntroPage.__vSpacing;
- if(this.__priDesc != undefined)
- {
- this.__priDesc._x = IntroPage.__pageBorder;
- this.__priDesc._y = _loc2_;
- _loc2_ += this.__priDesc.height + 125 + 2 * IntroPage.__vSpacing;
- }
- if(this.__secDesc != undefined)
- {
- this.__secDesc._x = IntroPage.__pageBorder;
- this.__secDesc._y = _loc2_;
- _loc2_ += this.__secDesc.height + IntroPage.__vSpacing;
- }
- }
- function draw(Void)
- {
- }
- function removeHTMLTags(htmlText)
- {
- var _loc6_ = function(txt, index)
- {
- return txt.indexOf("<",index);
- };
- var _loc8_ = function(txt, index)
- {
- return txt.indexOf(">",index);
- };
- var _loc2_ = new Array();
- var _loc7_ = 0;
- var _loc9_ = undefined;
- var _loc10_ = undefined;
- while(_loc7_ < htmlText.length)
- {
- _loc9_ = _loc6_(htmlText,_loc7_);
- if(_loc9_ == -1)
- {
- break;
- }
- _loc10_ = _loc8_(htmlText,_loc9_);
- var _loc3_ = _loc6_(htmlText,_loc10_);
- while(_loc3_ == _loc10_ + 1)
- {
- _loc10_ = _loc8_(htmlText,_loc3_);
- _loc3_ = _loc6_(htmlText,_loc10_);
- }
- _loc2_.push({start:_loc9_,end:_loc10_});
- _loc7_ = _loc10_ + 1;
- }
- var _loc5_ = 0;
- while(_loc5_ < _loc2_.length)
- {
- _loc9_ = _loc2_[_loc5_].start;
- var _loc11_ = htmlText.charAt(_loc2_[_loc5_].start);
- _loc10_ = _loc2_[_loc5_].end;
- var _loc12_ = htmlText.charAt(_loc2_[_loc5_].end);
- var _loc16_ = htmlText.substring(_loc9_ + 1,_loc10_);
- _loc5_ = _loc5_ + 1;
- }
- if(_loc2_.length != 0)
- {
- var _loc18_ = "";
- if(_loc2_[0].start > 0)
- {
- _loc18_ += htmlText.substring(0,_loc2_[0].start);
- }
- var _loc4_ = 0;
- while(_loc4_ < _loc2_.length - 1)
- {
- var _loc13_ = _loc2_[_loc4_].end + 1;
- var _loc15_ = _loc2_[_loc4_ + 1].start;
- _loc18_ += htmlText.substring(_loc2_[_loc4_].end + 1,_loc2_[_loc4_ + 1].start);
- _loc4_ = _loc4_ + 1;
- }
- if(_loc2_[_loc2_.length - 1].end < htmlText.length - 1)
- {
- _loc18_ += htmlText.substring(_loc2_[_loc2_.length - 1].end + 1);
- }
- return _loc18_;
- }
- return htmlText;
- }
- function sendMessage(p_msgtxt)
- {
- var _loc2_ = {target:this,type:"pageReady"};
- _loc2_.msgtxt = p_msgtxt;
- _loc2_.pageType = "IntroPage";
- this.dispatchEvent(_loc2_);
- }
- }
-